import java.util.*;

import javax.sound.midi.Soundbank;
public class GenericExercise02 {
    public static void main(String[] args) {
        ArrayList<Employee> ep = new ArrayList<>();
        ep.add(new Employee("tom", 20000, new MyDate(2000, 11, 11)));
        ep.add(new Employee("fucker", 22000, new MyDate(2020, 113, 113)));
        ep.add(new Employee("hsm", 50000, new MyDate(2023210, 321, 13)));
        System.out.println("ep="+ep);
        System.out.println("排序");
        ep.sort(new Comparator<Employee>() {
            @Override
            public int compare(Employee o1, Employee o2) {
                // TODO Auto-generated method stub
                if(!(o1 instanceof Employee&&o2 instanceof Employee)){
                    System.out.println("leixingbudui");
                    return 0;
                }
                int i=o1.getName().compareTo(o2.getName());
                if(i!=0){
                    return i;
                }
                int i1=o1.getBirthday().getYear()-o2.getBirthday().getYear();
                if(i1!=0){
                    return i1;
                }
                int i2=o1.getBirthday().getMonth()-o2.getBirthday().getMonth();
                if(i2!=0){
                    return i2;
                }
                int i3=o1.getBirthday().getDay()-o2.getBirthday().getDay();
                return i3;
            }
            
        });
        System.out.println(ep);
    }
}
class Employee{
    private String name;
    private double sal;
    private MyDate birthday;
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public double getSal() {
        return sal;
    }
    public void setSal(double sal) {
        this.sal = sal;
    }
    public MyDate getBirthday() {
        return birthday;
    }
    public void setBirthday(MyDate birthday) {
        this.birthday = birthday;
    }
    public Employee(String name, double sal, MyDate birthday) {
        this.name = name;
        this.sal = sal;
        this.birthday = birthday;
    }
    @Override
    public String toString() {
        // TODO Auto-generated method stub
        return name+" "+sal+" "+birthday.toString()+"\n";
    }
    

}
class MyDate{
    private int year,month,day;
    public MyDate(int year ,int month,int day){
        this.year=year;
        this.month=month;
        this.day=day;
    }
    public int getDay() {
        return day;
    }
    public int getMonth() {
        return month;
    }
    public int getYear() {
        return year;
    }
    public void setDay(int day) {
        this.day = day;
    }public void setMonth(int month) {
        this.month = month;
    }
    public void setYear(int year) {
        this.year = year;
    }
    @Override
    public String toString() {
        // TODO Auto-generated method stub
        return year+" "+month+" "+day;
    }
}